package string

import (
	"math/rand"
	"strings"
	"time"
)

// Rand 生成随机字符串
func Rand(size int) string {
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	chars := []byte("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
	l := len(chars)

	var result strings.Builder

	for i := 0; i < size; i++ {
		result.WriteByte(chars[r.Intn(l)])
	}

	return result.String()
}
